]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: Fix fullscreen windows in ws switching animations
authorJonas Dreßler <verdre@v0yd.nl>
Fri, 3 May 2019 20:56:02 +0000 (22:56 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Fri, 3 May 2019 22:14:04 +0000 (22:14 +0000)
To prevent a small gap between windows in the workspace switching
animation, we temporarily shift windows up or down by the height of the
panel. This obviously breaks the animation for fullscreen windows, those
will overlap with the ones on the other workspace since there is no
panel shown in that case.

Fix this by checking whether the old or new workspace includes a
fullscreen window and don't shift the windows if there is one.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/757

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/322

js/ui/windowManager.js

index b9f5fef46a476fd736b3c1f03bd46ac4f5cb7cc5..e80cfd483447c93b6ebe46a3259d6f512cd9e0f0 100644 (file)
@@ -1870,17 +1870,25 @@ var WindowManager = class {
         }
     }
 
-    _getPositionForDirection(direction) {
+    _getPositionForDirection(direction, fromWs, toWs) {
         let xDest = 0, yDest = 0;
 
+        let oldWsIsFullscreen = fromWs.list_windows().some(w => w.is_fullscreen());
+        let newWsIsFullscreen = toWs.list_windows().some(w => w.is_fullscreen());
+
+        // We have to shift windows up or down by the height of the panel to prevent having a
+        // visible gap between the windows while switching workspaces. Since fullscreen windows
+        // hide the panel, they don't need to be shifted up or down.
+        let shiftHeight = Main.panel.height;
+
         if (direction == Meta.MotionDirection.UP ||
             direction == Meta.MotionDirection.UP_LEFT ||
             direction == Meta.MotionDirection.UP_RIGHT)
-            yDest = -global.screen_height + Main.panel.height;
+            yDest = -global.screen_height + (oldWsIsFullscreen ? 0 : shiftHeight);
         else if (direction == Meta.MotionDirection.DOWN ||
             direction == Meta.MotionDirection.DOWN_LEFT ||
             direction == Meta.MotionDirection.DOWN_RIGHT)
-            yDest = global.screen_height - Main.panel.height;
+            yDest = global.screen_height - (newWsIsFullscreen ? 0 : shiftHeight);
 
         if (direction == Meta.MotionDirection.LEFT ||
             direction == Meta.MotionDirection.UP_LEFT ||
@@ -1938,7 +1946,7 @@ var WindowManager = class {
             switchData.container.add_actor(info.actor);
             info.actor.raise_top();
 
-            let [x, y] = this._getPositionForDirection(dir);
+            let [x, y] = this._getPositionForDirection(dir, curWs, ws);
             info.actor.set_position(x, y);
         }
 
@@ -2024,7 +2032,11 @@ var WindowManager = class {
 
         this._switchData.inProgress = true;
 
-        let [xDest, yDest] = this._getPositionForDirection(direction);
+        let workspaceManager = global.workspace_manager;
+        let fromWs = workspaceManager.get_workspace_by_index(from);
+        let toWs = workspaceManager.get_workspace_by_index(to);
+
+        let [xDest, yDest] = this._getPositionForDirection(direction, fromWs, toWs);
 
         /* @direction is the direction that the "camera" moves, so the
          * screen contents have to move one screen's worth in the